<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="root"></div>
    <script src="./vNode.js"></script>
    <script>
      /*
       1. 处理：style 传递对象 {}
       2. 处理：class传递数组 []
       3. 处理：事件函数  function
       
       Object.prototype.toString.call()
       Array.isArray

      */
      let ele = new CreateElement({
        tagName: 'ul',
        props: {
          class: ['box', 'box1'],
          style: {
            width: '100px',
            border: '2px solid #000',
          },
          onClick: () => {
            console.log('onClick')
          },
        },
        children: [
          'hello world',
          new CreateElement({
            tagName: 'h1',
            props: {
              class: 'h1-item',
            },
            children: ['我是h1'],
          }),
        ],
      })
      document.getElementById('root').appendChild(ele.render())
    </script>
  </body>
</html>
